<?php
// +----------------------------------------------------------------------
// | Copyright © Sogu Technologies Co. Ltd 2018-2050 All rights reserved.
// +----------------------------------------------------------------------
// | File name: ConvertNullToEmptyStrings.php
// +----------------------------------------------------------------------
// | Author: gxs
// +----------------------------------------------------------------------
// | Description: null转换为空字符串
// +----------------------------------------------------------------------
// | Others: 其他内容的说明
// +----------------------------------------------------------------------
// | History: 修改历史记录列表，每条修改记录应包含修改日期、修改者及修改内容简述
// +----------------------------------------------------------------------
// | 1.Date: 2019/1/22 Author: gxs Modification: 创建
// +----------------------------------------------------------------------

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\TransformsRequest;

class ConvertNullToEmptyStrings extends TransformsRequest
{

    /**
     * Description: null转换为空字符串中间件
     * Author: Gxs
     * @param string $key
     * @param mixed $value
     * @return mixed|string
     */
    protected function transform($key, $value)
    {
        return is_null($value) ? "" : $value;
    }
}